﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SchoolProject2012.Areas.Shared.Models;
using SchoolProject2012.Functions;

namespace SchoolProject2012.Areas.Shared.Controllers
{
    public class ActuController : Controller
    {
        private SchoolProjectBddEntities db = new SchoolProjectBddEntities();
        //
        // GET: /Shared/Actu/

        public ActionResult Index(string langue)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Field.getLanguage(langue));
            ViewBag.langue = langue;
            var news = db.ACTUALITE.Where(x => x.TOUS == true).ToList();
            return View(news);
        }

        public ViewResult Details(string langue, int id)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Field.getLanguage(langue));
            ViewBag.langue = langue;
            var news = db.ACTUALITE.Single(x => x.ID_ACTU == id);
            return View(news);
        }

    }
}
